package com.sprouting.personal.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sprouting.personal.annotations.CheckLength;
import com.sprouting.personal.annotations.CheckNotNull;
import com.sprouting.personal.model.common.BaseModel;
import com.sprouting.personal.model.common.jsr.AddGroup;
import com.sprouting.personal.model.common.jsr.UpdGroup;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

/**
 * 书籍
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2022/8/4 21:36
 */
@Data
@TableName("ps_book")
public class Book extends BaseModel {

    /**
     * 主键
     */
    @TableId
    @CheckNotNull(message = "非法ID", groups = UpdGroup.class)
    @Null(message = "无效ID", groups = AddGroup.class)
    private String id;
    /**
     * 所属用户ID
     * @see User#getId()
     */
    private String userId;
    /**
     * 书籍封面
     */
    @CheckLength(max = 255, message = "书籍封面超过长度限制")
    private String icoPath;
    /**
     * 上传书籍保存路径
     */
    @CheckLength(max = 255, message = "书籍保存路径超过长度限制")
    private String bookPath;
    /**
     * 书籍名称
     */
    @CheckLength(min = 1, max = 50, message = "书籍名称超过长度限制")
    @CheckNotNull(message = "请输入书籍名称")
    private String name;
    /**
     * 作者
     */
    @CheckLength(min = 1, max = 50, message = "作者信息超过长度限制")
    @CheckNotNull(message = "请输入作者信息")
    private String author;
    /**
     * 简介
     */
    @CheckLength(max = 2000, message = "书籍简介超过长度限制")
    private String briefIntroduction;
    /**
     * 点评，个人点评
     */
    private String comment;
    /**
     * 出版社
     */
    @CheckLength(max = 150, message = "出版社超过长度限制")
    private String press;
    /**
     * 出版年份-写书年份
     */
    private String publicationYear;
    /**
     * 书籍类型ID
     * @see Dict#getId()
     */
    @CheckNotNull(message = "请选择书籍类型")
    private String typeId;
    /**
     * 阅读地点
     * @see com.sprouting.personal.interfaces.common.Constant.ConfigCode#READING_ADDRESS 默认地点
     */
    private String locale;
    /**
     * 阅读进度-已阅读，列入计划
     * @see com.sprouting.personal.interfaces.common.Constant.ReadingProgress
     */
    private Integer speedOfProgress;
    /**
     * 评分，星星 1-5 ，最高5星
     */
    @NotNull(message = "请对书籍进行评分")
    private Integer grade;
    /**
     * 书本链接
     */
    @CheckLength(max = 355, message = "书本链接超过长度限制")
    private String link;
    /**
     * 书籍写作进度-书籍进度
     * @see com.sprouting.personal.interfaces.common.Constant.WritingProgress
     */
    private Integer writingProgress;
    /**
     * 是否追更
     * @see com.sprouting.personal.interfaces.common.Constant.YesOrNo#YES 继续追更
     */
    private Integer continueSee;
    /**
     * 阅读情况，到多少页,看到多少
     */
    private String page;


}
